# -*- coding: utf-8 -*-
#定义灰度值到彩色变换
L=255
def GetR(gray):
    if gray<L/2:
        return 0
    elif gray>L/4*3:
        return L
    else:
        return 4*gray-2*L
def GetG(gray):
    if gray<L/4:
        return 4*gray
    elif gray>L/4*3:
        return 4*L-4*gray
    else:
        return L
def GetB(gray):
    if gray<L/4:
        return L
    elif gray>L/2:
        return 0
    else:
        return 2*L-4*gray